package Test.jsp.common;

import java.io.File;
import java.io.FileWriter;

public class JSPMainTemp {


	public  static void jSPMainTest() throws  Exception{
			String rn = "\r\n";
			
			String src = 
			
			
			"<%@ page language=\"java\"  import=\"java.util.*\" pageEncoding=\"UTF-8\"%>" + rn + 
			"<%@ taglib uri=\"http://java.sun.com/jsp/jstl/core\" prefix=\"c\"%>" + rn + 
			"<%@ taglib prefix=\"form\" uri=\"http://www.springframework.org/tags/form\" %>" + rn + 
			"<%@ taglib prefix=\"fmt\" uri=\"http://java.sun.com/jsp/jstl/fmt\" %>" + rn + 
			"<%@ taglib prefix=\"fn\" uri=\"http://java.sun.com/jsp/jstl/functions\" %>" + rn + 
			"<%" + rn + 
			"String path = request.getContextPath();" + rn + 
			"String basePath = request.getScheme()+\"://\"+request.getServerName()+\":\"+request.getServerPort()+path+\"/\";" + rn + 
			"%>" + rn + 

			"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">" + rn + 
			"<html>" + rn + 
			"  <head>" + rn + 
			"    <base href=\"<%=basePath%>\">" + rn + 
			    
			"    <title>mainFrame</title>" + rn + 
			"  </head>" + rn + 

			"  <frameset border=\"0\" framespacing=\"0\" rows=\"60, *\" frameborder=\"0\">" + rn + 
			"  <FRAME name=header src=\"<%=basePath %>back/jsp/header.jsp\" frameBorder=\"0\" noResize scrolling=no>" + rn + 
			"  <FRAMESET cols=\"210, *\">" + rn + 
			"  <FRAME name=menu src=\"<%=basePath %>back/jsp/left.jsp\" frameBorder=\"0\" noResize>" + rn + 
			"  <FRAME name=main src=\"<%=basePath %>back/jsp/right.jsp\" frameBorder=\"0\" noResize scrolling=yes>" + rn + 
			"  </FRAMESET>" + rn + 
			"  </frameset>" + rn + 
			"  <noframes>" + rn + 
			"  </noframes>" + rn + 
			rn + 
			"</html>" + rn + 
			
			rn;
			
			String path = System.getProperty("user.dir")+"/WebRoot/back/jsp/";
			String fileName = System.getProperty("user.dir")+"/WebRoot/back/jsp/main.jsp";
			File fpath = new File(path);
			if (!fpath.exists()) {
			   fpath.mkdirs();
		    }
			File f = new File(fileName);
			FileWriter fw = new FileWriter(f);
			fw.write(src);
			fw.flush();
			fw.close();
	 }		
}
